import 'dart:io';

import 'package:lepig/router/Router.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluwx/fluwx.dart';
import 'common/config/theme.dart';
import 'pages/init/Init.dart';


void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
  if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
  }
}

// ignore: must_be_immutable
class MyApp extends StatelessWidget {
  MyApp(){
    _initFluwx();
    print("1123");
  }
  _initFluwx() async {
    await registerWxApi(
        appId: "wxecae9bae2220a3f9",
        doOnAndroid: true,
        doOnIOS: true,
        universalLink: "https://your.univerallink.com/link/");
    var result = await isWeChatInstalled;
    print("is installed $result");
  }
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: '乐猪',
      theme: theme(),
//     builder: (BuildContext context, Widget child) {
//        return FLToastProvider(
//        defaults: _toastDefaults,
//        child: initPage()
//        );
//      },
      home:  initPage(),
      onGenerateRoute: onGenerateRoute,
    );
  }
}

